const { sequelize } = require('../utils/database');

async function checkActivityFeeds() {
  try {
    console.log('检查activity_feeds表结构...');
    
    const [columns] = await sequelize.query("SHOW COLUMNS FROM activity_feeds;");
    
    console.log('activity_feeds表的列:');
    columns.forEach((column, index) => {
      console.log(`${index + 1}. ${column.Field} (${column.Type}) - ${column.Null === 'YES' ? 'NULL' : 'NOT NULL'}`);
    });
    
    console.log('\n检查表中的数据:');
    const [data] = await sequelize.query("SELECT * FROM activity_feeds LIMIT 5;");
    console.log('前5条数据:', data);
    
  } catch (error) {
    console.error('检查失败:', error);
    throw error;
  }
}

// 如果直接运行此脚本
if (require.main === module) {
  checkActivityFeeds()
    .then(() => {
      console.log('检查完成');
      process.exit(0);
    })
    .catch(error => {
      console.error('检查失败:', error);
      process.exit(1);
    });
}

module.exports = { checkActivityFeeds }; 